home *** CD-ROM | disk | FTP | other *** search
- package javax.swing.plaf.basic;
-
- import java.awt.BorderLayout;
- import java.awt.event.MouseListener;
- import java.beans.PropertyChangeListener;
- import java.io.File;
- import javax.swing.Action;
- import javax.swing.Icon;
- import javax.swing.JButton;
- import javax.swing.JComponent;
- import javax.swing.JFileChooser;
- import javax.swing.JList;
- import javax.swing.JPanel;
- import javax.swing.KeyStroke;
- import javax.swing.UIManager;
- import javax.swing.event.AncestorListener;
- import javax.swing.event.ListSelectionListener;
- import javax.swing.filechooser.FileFilter;
- import javax.swing.filechooser.FileView;
- import javax.swing.plaf.FileChooserUI;
-
- public class BasicFileChooserUI extends FileChooserUI {
- protected Icon directoryIcon = null;
- protected Icon fileIcon = null;
- protected Icon computerIcon = null;
- protected Icon hardDriveIcon = null;
- protected Icon floppyDriveIcon = null;
- protected Icon newFolderIcon = null;
- protected Icon upFolderIcon = null;
- protected Icon homeFolderIcon = null;
- protected Icon listViewIcon = null;
- protected Icon detailsViewIcon = null;
- protected int saveButtonMnemonic = 0;
- protected int openButtonMnemonic = 0;
- protected int cancelButtonMnemonic = 0;
- protected int updateButtonMnemonic = 0;
- protected int helpButtonMnemonic = 0;
- protected String saveButtonText = null;
- protected String openButtonText = null;
- protected String cancelButtonText = null;
- protected String updateButtonText = null;
- protected String helpButtonText = null;
- private String newFolderErrorSeparator = null;
- private String newFolderErrorText = null;
- private String fileDescriptionText = null;
- private String directoryDescriptionText = null;
- protected String saveButtonToolTipText = null;
- protected String openButtonToolTipText = null;
- protected String cancelButtonToolTipText = null;
- protected String updateButtonToolTipText = null;
- protected String helpButtonToolTipText = null;
- private Action approveSelectionAction = new ApproveSelectionAction(this);
- private Action cancelSelectionAction = new CancelSelectionAction(this);
- private Action updateAction = new UpdateAction(this);
- private Action newFolderAction = new NewFolderAction(this);
- private Action goHomeAction = new GoHomeAction(this);
- private Action changeToParentDirectoryAction = new ChangeToParentDirectoryAction(this);
- private JFileChooser filechooser = null;
- private PropertyChangeListener propertyChangeListener = null;
- private AncestorListener ancestorListener = null;
- private AcceptAllFileFilter acceptAllFileFilter = new AcceptAllFileFilter(this);
- private BasicDirectoryModel model = null;
- private BasicFileView fileView = new BasicFileView(this);
- private JPanel accessoryPanel = null;
-
- public BasicFileChooserUI(JFileChooser var1) {
- }
-
- // $FF: synthetic method
- static String access$0(BasicFileChooserUI var0) {
- return var0.newFolderErrorText;
- }
-
- // $FF: synthetic method
- static String access$1(BasicFileChooserUI var0) {
- return var0.newFolderErrorSeparator;
- }
-
- // $FF: synthetic method
- static String access$2(BasicFileChooserUI var0) {
- return var0.directoryDescriptionText;
- }
-
- // $FF: synthetic method
- static String access$3(BasicFileChooserUI var0) {
- return var0.fileDescriptionText;
- }
-
- public void clearIconCache() {
- this.fileView.clearIconCache();
- }
-
- protected MouseListener createDoubleClickListener(JFileChooser var1, JList var2) {
- return new DoubleClickListener(this, var2);
- }
-
- public ListSelectionListener createListSelectionListener(JFileChooser var1) {
- return new SelectionListener(this);
- }
-
- protected void createModel() {
- this.model = new BasicDirectoryModel(this.getFileChooser());
- }
-
- public PropertyChangeListener createPropertyChangeListener(JFileChooser var1) {
- return null;
- }
-
- public void ensureFileIsVisible(JFileChooser var1, File var2) {
- }
-
- public FileFilter getAcceptAllFileFilter(JFileChooser var1) {
- return this.acceptAllFileFilter;
- }
-
- public JPanel getAccessoryPanel() {
- return this.accessoryPanel;
- }
-
- protected JButton getApproveButton(JFileChooser var1) {
- return null;
- }
-
- public int getApproveButtonMnemonic(JFileChooser var1) {
- if (this.getFileChooser().getDialogType() == 0) {
- return this.openButtonMnemonic;
- } else if (this.getFileChooser().getDialogType() == 1) {
- return this.saveButtonMnemonic;
- } else {
- int var2 = this.getFileChooser().getApproveButtonMnemonic();
- return var2;
- }
- }
-
- public String getApproveButtonText(JFileChooser var1) {
- String var2 = this.getFileChooser().getApproveButtonText();
- if (var2 != null) {
- return var2;
- } else if (this.getFileChooser().getDialogType() == 0) {
- return this.openButtonText;
- } else {
- return this.getFileChooser().getDialogType() == 1 ? this.saveButtonText : null;
- }
- }
-
- public String getApproveButtonToolTipText(JFileChooser var1) {
- String var2 = var1.getApproveButtonToolTipText();
- if (var2 != null) {
- return var2;
- } else if (var1.getDialogType() == 0) {
- return this.openButtonToolTipText;
- } else {
- return var1.getDialogType() == 1 ? this.saveButtonToolTipText : null;
- }
- }
-
- public Action getApproveSelectionAction() {
- return this.approveSelectionAction;
- }
-
- public Action getCancelSelectionAction() {
- return this.cancelSelectionAction;
- }
-
- public Action getChangeToParentDirectoryAction() {
- return this.changeToParentDirectoryAction;
- }
-
- public String getDialogTitle(JFileChooser var1) {
- return this.getApproveButtonText(var1);
- }
-
- public String getDirectoryName() {
- return null;
- }
-
- public JFileChooser getFileChooser() {
- return this.filechooser;
- }
-
- public String getFileName() {
- return null;
- }
-
- public FileView getFileView(JFileChooser var1) {
- return this.fileView;
- }
-
- public Action getGoHomeAction() {
- return this.goHomeAction;
- }
-
- public BasicDirectoryModel getModel() {
- return this.model;
- }
-
- public Action getNewFolderAction() {
- return this.newFolderAction;
- }
-
- public Action getUpdateAction() {
- return this.updateAction;
- }
-
- public void installComponents(JFileChooser var1) {
- }
-
- protected void installDefaults(JFileChooser var1) {
- this.installIcons(var1);
- this.installStrings(var1);
- }
-
- protected void installIcons(JFileChooser var1) {
- this.directoryIcon = UIManager.getIcon("FileView.directoryIcon");
- this.fileIcon = UIManager.getIcon("FileView.fileIcon");
- this.computerIcon = UIManager.getIcon("FileView.computerIcon");
- this.hardDriveIcon = UIManager.getIcon("FileView.hardDriveIcon");
- this.floppyDriveIcon = UIManager.getIcon("FileView.floppyDriveIcon");
- this.newFolderIcon = UIManager.getIcon("FileChooser.newFolderIcon");
- this.upFolderIcon = UIManager.getIcon("FileChooser.upFolderIcon");
- this.homeFolderIcon = UIManager.getIcon("FileChooser.homeFolderIcon");
- this.detailsViewIcon = UIManager.getIcon("FileChooser.detailsViewIcon");
- this.listViewIcon = UIManager.getIcon("FileChooser.listViewIcon");
- }
-
- protected void installListeners(JFileChooser var1) {
- this.propertyChangeListener = this.createPropertyChangeListener(var1);
- if (this.propertyChangeListener != null) {
- ((JComponent)var1).addPropertyChangeListener(this.propertyChangeListener);
- }
-
- ((JComponent)var1).addPropertyChangeListener(this.model);
- this.ancestorListener = new 1(this);
- ((JComponent)var1).addAncestorListener(this.ancestorListener);
- 2 var2 = new 2(this);
- ((JComponent)var1).registerKeyboardAction(var2, KeyStroke.getKeyStroke(27, 0), 1);
- }
-
- protected void installStrings(JFileChooser var1) {
- this.newFolderErrorText = UIManager.getString("FileChooser.newFolderErrorText");
- this.newFolderErrorSeparator = UIManager.getString("FileChooser.newFolderErrorSeparator");
- this.fileDescriptionText = UIManager.getString("FileChooser.fileDescriptionText");
- this.directoryDescriptionText = UIManager.getString("FileChooser.directoryDescriptionText");
- this.saveButtonText = UIManager.getString("FileChooser.saveButtonText");
- this.openButtonText = UIManager.getString("FileChooser.openButtonText");
- this.cancelButtonText = UIManager.getString("FileChooser.cancelButtonText");
- this.updateButtonText = UIManager.getString("FileChooser.updateButtonText");
- this.helpButtonText = UIManager.getString("FileChooser.helpButtonText");
- this.saveButtonMnemonic = UIManager.getInt("FileChooser.saveButtonMnemonic");
- this.openButtonMnemonic = UIManager.getInt("FileChooser.openButtonMnemonic");
- this.cancelButtonMnemonic = UIManager.getInt("FileChooser.cancelButtonMnemonic");
- this.updateButtonMnemonic = UIManager.getInt("FileChooser.updateButtonMnemonic");
- this.helpButtonMnemonic = UIManager.getInt("FileChooser.helpButtonMnemonic");
- this.saveButtonToolTipText = UIManager.getString("FileChooser.saveButtonToolTipText");
- this.openButtonToolTipText = UIManager.getString("FileChooser.openButtonToolTipText");
- this.cancelButtonToolTipText = UIManager.getString("FileChooser.cancelButtonToolTipText");
- this.updateButtonToolTipText = UIManager.getString("FileChooser.updateButtonToolTipText");
- this.helpButtonToolTipText = UIManager.getString("FileChooser.helpButtonToolTipText");
- }
-
- public void installUI(JComponent var1) {
- this.accessoryPanel = new JPanel(new BorderLayout());
- this.filechooser = (JFileChooser)var1;
- this.createModel();
- this.installDefaults(this.filechooser);
- this.installComponents(this.filechooser);
- this.installListeners(this.filechooser);
- }
-
- public void rescanCurrentDirectory(JFileChooser var1) {
- }
-
- public void setDirectoryName(String var1) {
- }
-
- public void setFileName(String var1) {
- }
-
- public void uninstallComponents(JFileChooser var1) {
- }
-
- protected void uninstallDefaults(JFileChooser var1) {
- this.uninstallIcons(var1);
- this.uninstallStrings(var1);
- }
-
- protected void uninstallIcons(JFileChooser var1) {
- this.directoryIcon = null;
- this.fileIcon = null;
- this.computerIcon = null;
- this.hardDriveIcon = null;
- this.floppyDriveIcon = null;
- this.newFolderIcon = null;
- this.upFolderIcon = null;
- this.homeFolderIcon = null;
- this.detailsViewIcon = null;
- this.listViewIcon = null;
- }
-
- protected void uninstallListeners(JFileChooser var1) {
- if (this.propertyChangeListener != null) {
- ((JComponent)var1).removePropertyChangeListener(this.propertyChangeListener);
- }
-
- ((JComponent)var1).removePropertyChangeListener(this.model);
- ((JComponent)var1).unregisterKeyboardAction(KeyStroke.getKeyStroke(27, 0));
- ((JComponent)var1).removeAncestorListener(this.ancestorListener);
- this.ancestorListener = null;
- }
-
- protected void uninstallStrings(JFileChooser var1) {
- this.saveButtonText = null;
- this.openButtonText = null;
- this.cancelButtonText = null;
- this.updateButtonText = null;
- this.helpButtonText = null;
- this.saveButtonToolTipText = null;
- this.openButtonToolTipText = null;
- this.cancelButtonToolTipText = null;
- this.updateButtonToolTipText = null;
- this.helpButtonToolTipText = null;
- }
-
- public void uninstallUI(JComponent var1) {
- this.uninstallListeners(this.filechooser);
- this.uninstallComponents(this.filechooser);
- this.uninstallDefaults(this.filechooser);
- if (this.accessoryPanel != null) {
- this.accessoryPanel.removeAll();
- }
-
- this.accessoryPanel = null;
- this.getFileChooser().removeAll();
- }
- }
-